public class Main {
    public static void main(String[] args) {
        Solution s = new Solution();
        System.out.println(s.isPerfectSquare(16));
        System.out.println(s.isPerfectSquare(14));
    }
}


class Solution {
    public boolean isPerfectSquare(int num) {
        int l = 1, r = num;
        while (l <= r){
            int mid = (l + r) / 2;
            long value = (long) mid * mid;
            if(value == num){
                return true;
            }
            if(value < num){
                l = mid + 1;
            }
            else{
                r = mid - 1;
            }
        }
        return false;
    }
}